const obj1 = {
  age: 18,
  name: 'zg',
  friends: ['lucy', 'jam']
}
const result = Object.entries(obj1);
console.log(result);
/* 结果
[
  [ "age", 18 ],
  [ "name", "zg" ],
  [ "friends",["lucy", "jam"] ]
]
*/

const result2 = Object.entries({
  obj: {
    aa: 'aa',
    bb: 'bb'
  },
  age: 18,
  arr: [1, 2, 3, 4]
});
console.log(result2);
/* 结果
[
  [ "obj", { "aa": "aa", "bb": "bb" } ],
  [ "age", 18 ],
  [ "arr", [ 1, 2, 3, 4 ] ]
]
*/

const result3 = Object.entries("abcdefg");
console.log(result3)
/* 结果
[
  [ "0", "a" ],
  [ "1", "b" ],
  [ "2", "c" ],
  [ "3", "d" ],
  [ "4", "e" ],
  [ "5", "f" ],
  [ "6", "g" ]
]
*/
